package com.atguigu.day13.study.anonymityclass;

import org.junit.Test;

/**
 * @version 1.0
 * @Author 马冰
 * @Date 2024/11/15 14:25
 * @注释
 */
public class innerTest {
    @Test
    public void test1(){
        new Fly(){

            @Override
            public void flying() {
                System.out.println("小鸟飞。。。。");
            }
        }.flying();
    }
    @Test
    public void test2(){
        Animal a = new Animal(){

            @Override
            public void eat() {
                System.out.println("小狗吃饭");
            }

            @Override
            public void sleep() {
                System.out.println("小狗睡觉");
            }
        };
        a.eat();
        a.sleep();
    }
}
